package com.supermap.test;

import com.supermap.analyst.spatialanalyst.MultilayerOverlayResult;
import com.supermap.analyst.spatialanalyst.OverlayAnalyst;
import com.supermap.data.*;

import java.util.Arrays;
import java.util.logging.Handler;

public class YashanUpdateField {
    public static void main(String[] args) {

        Workspace workspace = new Workspace();
        WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo(
                "E:\\MapData\\202410\\WorkSpaceYS.smwu");
        conInfo.setType(WorkspaceType.SMWU);
        workspace.open(conInfo);

//        com.yashandb.jdbc.Driver driver = new com.yashandb.jdbc.Driver();


//        DatasourceConnectionInfo datasourceConnectionInfo = new DatasourceConnectionInfo();
//        datasourceConnectionInfo.setAlias("YASHAN22");
//        datasourceConnectionInfo.setDatabase("TEST");
//        datasourceConnectionInfo.setEngineType(EngineType.YASHAN);
//        datasourceConnectionInfo.setServer("172.16.13.64:1688");
//        datasourceConnectionInfo.setUser("sys");
//        datasourceConnectionInfo.setPassword("Supermap_12");
//        datasourceConnectionInfo.setDriver("com.yashandb.jdbc.Driver");
//
//        workspace.getDatasources().open(datasourceConnectionInfo);


        Datasource d = workspace.getDatasources().get(0);
        System.out.println(workspace.getDatasources().getCount());
        DatasetVector datasetVector = (DatasetVector)d.getDatasets().get("NewPoint");
        datasetVector.updateField("COL",3, "SMID=1");
        datasetVector.dispose();

        Datasource d2 = workspace.getDatasources().get(1);
        DatasetVector datasetVector2 = (DatasetVector)d2.getDatasets().get("NewPoint");
        datasetVector2.updateField("COL",4, "SMID=7");
        datasetVector2.dispose();


        workspace.save();
        workspace.dispose();



    }
}
